<include file="Public/header"/>

<div class="x-nav">
      <span class="layui-breadcrumb">

      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
    </div>
    <div class="x-body">
      <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so" action="{:U('')}" method="get">
           <div class="layui-input-inline">
            <select name="status">
              <option value="0" selected='selected'>优惠卷状态</option>
              <option value="1" <if condition=" $status eq 1"> selected='selected' </if>>下架</option>
              <option value="2" <if condition=" $status eq 2"> selected='selected' </if>>上架</option>
            </select>
          </div>
          
          <div class="layui-input-inline">
            <select name="type">
              <option value="0" selected='selected'>优惠卷类型</option>
              <option value="1" <if condition=" $type eq 1"> selected='selected' </if>>通用卷</option>
              <option value="2" <if condition=" $type eq 2"> selected='selected' </if>>满减卷</option>
            </select>
          </div>
          
          <button class="layui-btn"   type="submit" ><i class="layui-icon">&#xe615;</i></button>
        </form>
      </div>
      <xblock>
      	<button class="layui-btn" onclick="x_admin_show('添加优惠卷','{:U('add')}')"><i class="layui-icon"></i>添加</button>
        <button class="layui-btn layui-bg-red" onclick="delAll('','{:U('del')}')"><i class="layui-icon"></i>永久删除</button>
        <span class="x-right" style="line-height:40px">共有数据：{$count} 条</span>
      </xblock>
      <table class="layui-table">
        <thead>
          <tr>
            <th>
              <div class="layui-unselect header layui-form-checkbox" lay-skin="primary"><i class="layui-icon">&#xe605;</i></div>
            </th>
            <th>ID</th>
            <th>抵用金额</th>
            <th>类型</th>
            <th>备注</th>
            <th>截止日期</th>
            <th>可领取张数</th>
            <th>状态</th>
            <th>满足金额</th>
            <th>操作</th>
            </tr>
        </thead>
        <tbody>
        <volist name="list" id="vo">
          <tr>
            <td>
              <div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id={$vo['id']}><i class="layui-icon">&#xe605;</i></div>
            </td>
            <td>{$vo['id']}</td>
            <td>{$vo['jiner']}</td>
            <td>
            	<if condition='$vo["type"] eq 1'>通用券</if>
            	<if condition='$vo["type"] eq 2'>满减</if>
            	<if condition='$vo["type"] eq 3'>指定商品</if>
            </td>
            <td>{$vo['tips']}</td>
            <td>{$vo['endtime']|date="Y-m-d H:is",###}</td>
            <td>{$vo['amount']}</td>
            <td><if condition='$vo["status"] eq 1'><font color='red'>下架</font><else/><font color='green'>上架</font></if></td>
            <td>{$vo['money']}</td>
            <td class="td-manage">
              <a title="编辑" class="layui-btn layui-btn-xs"  onclick="x_admin_show('编辑','{:U('edit',array('id'=>$vo['id']))}')" href="javascript:;">
                编辑
              </a>
              
			<if condition='$vo["status"] eq 1'>
              <a title="上架"  class="layui-btn layui-btn-warm layui-btn-xs" onclick="setStatus(this,'{$vo['id']}','{:U('isstatus')}')" href="javascript:;">
                上架
              </a>
			<else/>
              <a title="下架"  class="layui-btn layui-btn-warm layui-btn-xs" onclick="setStatus(this,'{$vo['id']}','{:U('isstatus')}')" href="javascript:;">
      	下架
              </a>
			</if>							                           
            </td>
          </tr>
        </volist>


        </tbody>
      </table>
      <div class="page" id="page">
        {$page}
      </div>

    </div>
    <script>


       /*用户-停用*/
      function member_stop(obj,id){
          layer.confirm('确认要停用吗？',function(index){

              if($(obj).attr('title')=='启用'){

                //发异步把用户状态进行更改
                $(obj).attr('title','停用')
                $(obj).find('i').html('&#xe62f;');

                $(obj).parents("tr").find(".td-status").find('span').addClass('layui-btn-disabled').html('已停用');
                layer.msg('已停用!',{icon: 5,time:1000});

              }else{
                $(obj).attr('title','启用')
                $(obj).find('i').html('&#xe601;');

                $(obj).parents("tr").find(".td-status").find('span').removeClass('layui-btn-disabled').html('已启用');
                layer.msg('已启用!',{icon: 5,time:1000});
              }
              
          });
      }


    </script>

<include file="Public/footer"/>

